﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/master/admin.master"
    CodeFile="shipping-rate-list.aspx.cs" Inherits="admin_shipping_rate_list" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<asp:Content ContentPlaceHolderID="AdminHeaderContent" runat="Server">
</asp:Content>
<asp:Content ContentPlaceHolderID="cphMiddleContent" runat="Server">
<script type="text/javascript">
    var categoryGrid;
    var onDocumentReady = function (grid) {
        categoryGrid = grid;
    }

    var Taka_Renderer = function (value) {
        return "TK." + value;
    }

    var ProductName_Render = function (value, p, record, rowIndex) {
        var categoryUrl = "<%= SiteGlobals.BaseUrl %>" + "admin/shipping-rate-edit.aspx?id=" + record.data.Id;
        return '<a href="' + categoryUrl + '" class="leftlink">' + value + '</a>';
    };

</script>
<ext:ResourceManager ID="ScriptManager1" runat="server" Theme="Gray">
        <Listeners>
            <DocumentReady Fn="onDocumentReady(#{GridPanel1})" />
        </Listeners>
    </ext:ResourceManager>
    <ext:Store ID="Store1" runat="server" RemoteSort="true" OnRefreshData="Store1_RefreshData">
        <AutoLoadParams>
            <ext:Parameter Name="sort" Value="Id" Mode="Value" />
            <ext:Parameter Name="start" Value="0" Mode="Raw" />
            <ext:Parameter Name="limit" Value="50" Mode="Raw" />
        </AutoLoadParams>
        <Proxy>
            <ext:PageProxy />
        </Proxy>
        <Reader>
            <ext:JsonReader IDProperty="Id">
                <Fields>
                    <ext:RecordField Name="Id" />
                    <ext:RecordField Name="City" ServerMapping="ToCity.Name"  />
                    <ext:RecordField Name="State" ServerMapping="ToCity.CityState.Name" />
                    <ext:RecordField Name="Country" ServerMapping="ToCity.CityState.StateCountry.Name" />
                    <ext:RecordField Name="FromWeight" ServerMapping="FromWeight" />
                    <ext:RecordField Name="ToWeight" ServerMapping="ToWeight" />
                    <ext:RecordField Name="Rate" ServerMapping="Rate" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <div class="admin-function-top inline">
    <ext:GridPanel ID="GridPanel1" runat="server" EnableViewState="true" AutoHeight="true"
            StoreID="Store1">
            <ColumnModel>
                <Columns>
                    <ext:Column Header="City" Width="80" DataIndex="City">
                         <Renderer Fn="ProductName_Render" />
                    </ext:Column>
                     <ext:Column Header="State" Width="80" DataIndex="State"></ext:Column>
                    <ext:Column Header="Country" Width="80" DataIndex="Country"></ext:Column>
                    <ext:Column Header="FromWeight" Width="80" DataIndex="FromWeight"></ext:Column>
                    <ext:Column Header="ToWeight" Width="80" DataIndex="ToWeight"></ext:Column>
                    <ext:Column Header="Rate" Width="80" DataIndex="Rate">
                    <Renderer Fn="Taka_Renderer" />
                    </ext:Column>
                </Columns>
            </ColumnModel>
            
            <BottomBar>
                <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="50" DisplayInfo="true"
                    DisplayMsg="Displaying rates {0} - {1} of {2}" EmptyMsg="No customers to display"
                    AutoWidth="true" />
            </BottomBar>
            <LoadMask ShowMask="true" />            
         
            <View>
                <ext:GridView ID="GridView1" runat="server" ForceFit="true" />
            </View>
        </ext:GridPanel>
        </div>
</asp:Content>
